//
//  AuctionRecordViewCell.m
//  phmall
//
//  Created by admin on 2017/12/5.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "AuctionRecordViewCell.h"

@implementation AuctionRecordViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
+ (instancetype)theShareCellWithTableView:(UITableView *)tableView{
    
    static NSString *ID = @"SetCell";
    AuctionRecordViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[AuctionRecordViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.type=[[UILabel alloc]init];
        self.type.text=@"领先";
        self.type.font=[UIFont systemFontOfSize:13];
        self.type.textColor=[UIColor whiteColor];
        self.type.textAlignment=NSTextAlignmentCenter;
        ViewBorderRadius(self.type, 3, 0, [UIColor clearColor]);
        self.type.backgroundColor=[UIColor orangeColor];
        [self.contentView addSubview:self.type];
        
        self.name=[[UILabel alloc]init];
        self.name.text=@"admin";
        self.name.textColor=[UIColor orangeColor];
        self.name.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.name];
        
        self.price=[[UILabel alloc]init];
        self.price.text=@"₱99999";
        self.price.textColor=[UIColor orangeColor];
        self.price.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.price];
        
        self.time=[[UILabel alloc]init];
        self.time.text=@"2017.10.20 10:23:14";
        self.time.textColor=[UIColor orangeColor];
        self.time.textAlignment=NSTextAlignmentCenter;
        self.time.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.time];
        
        self.line=[[UIView alloc]init];
        self.line.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [self.contentView addSubview:self.line];
    }
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.contentView.frame.size;
    
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }
    
    [self.type mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.left.offset(10);
        make.width.offset(37);
        make.height.offset(22);
    }];
    
    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.left.equalTo(self.type.mas_right).offset(20);
        make.width.offset(50);
    }];
    
    [self.price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.width.offset((SCREEN_WIDTH-140)/3);
        make.left.equalTo(self.name.mas_right).offset(20);
    }];
    
    [self.time mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.right.equalTo(self).offset(-10);
        make.left.equalTo(self.price.mas_right).offset(20);
    }];
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.right.offset(0);
        make.height.offset(1);
        make.top.offset(0);
    }];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
